package com.ayi.servlet.base; /**
 * @author Ayingzz
 * @create 2021/11/30 20:19
 */

import com.ayi.bean.User;
import com.ayi.dao.bookdao.QueryBook;
import com.ayi.dao.bookdao.QueryTypes;
import com.ayi.dao.userdao.QueryUser;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@WebServlet(name = "BackStageServlet", value = "/BackStageServlet")
public class BackStageServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        /**
         * 图书
         */
            // 准备好所有图书
            request.getSession().setAttribute("books", new QueryBook().queryBooksByTypeAndName("全部类型", ""));

            // 准备好供修改类型
            request.getSession().setAttribute("typesSetting", new QueryTypes().queryTypes(1));

            // 准备好初始修改状态
            request.getSession().setAttribute("map", new QueryBook().queryBooksIdForInitEditStatus());

            // 准备好默认类型选择
            request.getSession().setAttribute("typeSelected", "全部类型");


        request.getRequestDispatcher("backStage.jsp").forward(request, response);
    }
}
